﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities.Auditing;
using Hangfire.Annotations;
using Hicap.AuthorizationServer.Core.Models.Other;

namespace Hicap.AuthorizationServer.Core.Models
{
    public class AuthObject : FullAuditedEntity
    {
        public bool IsActive { get; set; } = true;

        /// <summary>
        /// 权限编码
        /// </summary>
        [Required]
        [StringLength(EntityLengthConst.LongCode)]
        public string ObjectCode { get; set; }

        /// <summary>
        /// 权限名称
        /// </summary>
        [Required]
        [StringLength(EntityLengthConst.LongName)]
        public string ObjectName { get; set; }

        /// <summary>
        /// 是否终极节点(0:false 1:true)
        /// </summary>
        public sbyte IsTailNode { get; set; }

        [ForeignKey("AuthObject")]
        [CanBeNull]
        public int? ParentObjectId { get; set; }

        public virtual AuthObject ParentObject { get; set; }
    }
}